package com.wushibo.adddatabackend.controller;

import com.wushibo.adddatabackend.mapper.PersonInforMapper;
import com.wushibo.adddatabackend.utils.Result;
import com.wushibo.adddatabackend.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.swing.event.InternalFrameEvent;

@RestController
@RequestMapping("/delete")
@Api(value = "DeleteData Controller",tags = "删除疫情数据接口")
public class DeletePersonInfor {
    @Autowired
    private PersonInforMapper personInforMapper;
    @ApiOperation(value = "删除数据接口", notes = "删除数据", httpMethod = "POST")
    @RequestMapping("/persondata")
    public Result deletePersonInfor(@RequestBody String id){
        System.out.println("当前传送的值id为==》"+id.substring(0,1));
        int id1=Integer.parseInt(id.substring(0,1));
        int result=personInforMapper.deleteById(id1);
        if(result==1){
            return ResultUtil.success("疫情数据删除成功");
        }else{
            return ResultUtil.error("省级数据删除失败");
        }
    }
}
